package org.budo.dubbo.protocol.http.invocation;

import com.alibaba.dubbo.rpc.Invocation;
import com.alibaba.dubbo.rpc.RpcInvocation;

import lombok.Getter;
import lombok.Setter;

/**
 * 扩展了 RpcInvocation
 * 
 * @author lmw
 */
@Getter
@Setter
public class BudoDubboRpcInvocation extends RpcInvocation {
    private static final long serialVersionUID = 6371604131786981852L;

    public static final String BUDO_INVOCATION_IN_REQUEST_ATTRIBUTE_KEY = "BUDO_INVOCATION_IN_REQUEST_ATTRIBUTE_KEY";

    private transient String interfaceName;

    /**
     * TODO requestBody 不用 String 存储，用 byte[]
     */
    private transient String requestBody;

    private transient Boolean responseBody;

    public BudoDubboRpcInvocation() {}

    public BudoDubboRpcInvocation(Invocation invocation, String requestBody) {
        super(invocation);

        this.setRequestBody(requestBody);
    }

    public String toString() {
        return this.getClass().getName() + "@" + Integer.toHexString(this.hashCode()) //
                + ", super=" + super.toString() //
                + ", requestBody=" + this.getRequestBody();
    }
}
